home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 16 / AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso / pd / anwendungen / xpk_source / test / printfiletypes.c < prev    next >
C/C++ Source or Header  |  1998-08-27  |  2KB  |  74 lines

  1. #define NAME        "PrintFileTypes"
  2. #define DISTRIBUTION    "(Freeware) "
  3. #define REVISION    "0"
  4.  
  5. /* NOTE: This program depends on certain things, which may change. It is
  6. only valid as long as the XpkMasterPrefs internal structures do not change.
  7. It is only for tests and no standard use tool!!! Never distribute a binary
  8. version of it or use it's routines in other programs! */
  9.  
  10. /* Programmheader
  11.  
  12.     Name:        PrintFileTypes
  13.     Author:        SDI
  14.     Distribution:    Freeware
  15.     Description:    shows all filetypes defined with XpkMasterPrefs
  16.     Compileropts:    -
  17.     Linkeropts:    -l amiga
  18.  
  19.  1.0   06.07.97 : first Version
  20. */
  21.  
  22. #include <proto/exec.h>
  23. #include <proto/dos.h>
  24. #include <xpk/xpkprefs.h>
  25. #include "SDI_defines.h"
  26.  
  27. struct XpkTypeNode {
  28.   struct Node        xtn_Node;    /* standard node structure */
  29.   ULONG            xtn_Size;    /* hold complete size to free */
  30.   struct XpkTypePrefs    xtn_TypePrefs;  /* real data */
  31. };
  32.  
  33. void main()
  34. {
  35.   struct XpkPrefsSemaphore *semaphore;
  36.   struct XpkTypeNode *td;
  37.  
  38.   Forbid();
  39.   if((semaphore = (struct XpkPrefsSemaphore *) FindSemaphore(XPKPREFSSEMNAME)))
  40.     ObtainSemaphoreShared((struct SignalSemaphore *) semaphore);
  41.   Permit();
  42.   if(semaphore)
  43.   {
  44.     if(semaphore->xps_PrefsType == XPREFSTYPE_STANDARD)
  45.     {
  46.       struct Node *n;
  47.       UBYTE a[5] = "----";
  48.       for(n = ((struct List *)semaphore->xps_PrefsData)->lh_Head;
  49.         n->ln_Succ; n = n->ln_Succ)
  50.       {
  51.         td = (struct XpkTypeNode *) n;
  52.  
  53.         if(td->xtn_TypePrefs.xtp_PackerData->xtd_Flags & XTD_NoPack)
  54.           a[0] = a[1] = a[2] = a[3] = '-';
  55.         else if(td->xtn_TypePrefs.xtp_PackerData->xtd_Flags & XTD_ReturnError)
  56.           a[0] = a[1] = a[2] = a[3] = '*';
  57.         else
  58.         {
  59.           a[0] = td->xtn_TypePrefs.xtp_PackerData->xtd_StdID>>24;
  60.           a[1] = td->xtn_TypePrefs.xtp_PackerData->xtd_StdID>>16;
  61.           a[2] = td->xtn_TypePrefs.xtp_PackerData->xtd_StdID>>8;
  62.           a[3] = td->xtn_TypePrefs.xtp_PackerData->xtd_StdID;
  63.         }
  64.  
  65.         Printf("%-20s %-15s %s %s\n", td->xtn_TypePrefs.xtp_TypeName,
  66.         td->xtn_TypePrefs.xtp_NamePattern, a,
  67.         td->xtn_TypePrefs.xtp_FilePattern);
  68.       }
  69.     }
  70.     ReleaseSemaphore((struct SignalSemaphore *) semaphore);
  71.   }
  72. }
  73.  
  74.